package com.cloudwise.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2021/2/23 14:22
 * @description：字符编码过滤器
 * @modified By：
 * @version: 1.0
 */
@WebFilter(urlPatterns = "/")
public class ATest1Filter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

        System.out.println("test1过滤器初始化了");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("test1过滤器工作中");
        //插入数据到数据库表
       // servletRequest.getParameter()
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {
        System.out.println("test1过滤器销毁了");
    }
}
